import SynchronizationLoginNork from '@/utils/SynchronizationLoginWork'
import Synchronization from "@/utils/Synchronization"
import LoginWork from '@/utils/LoginWork'
import service from '@/utils/request'
// 型体查询
export interface TypeQueryParms{
    colorCode:string,
    pageNum:number,
    pageSize:number,
    styleColor:string,
    styleNo:string
}

export const TypeQuery = (parms:TypeQueryParms) => {
    return service.post<any,any>("/usage/getStyleQuery",parms)
}

// 颜色代码
export interface ColorCodePictureParms{
    colorCode:string,
    pageNum:number,
    pageSize:number,
    styleColor:string,
    styleNo:string
}

export interface ColorCodePictureTableDate{
    list:list[]
    total?:number
}

interface list{
    styleColor: string,
    colorCode: string,
    photoPath: string
    remark: string
}

export const ColorCodePicture = (parms:ColorCodePictureParms) => {
    return service.post<any,any>(`/usage/getStyleToColorQuery`,parms)
}

// 型体颜色资料查询
export interface TypeColorDataQueryParms{
    styleNo:string
    styleColor:string
}

export interface TypeColorDataQueryInterface{
    seqNo: string | number,
    partName: any,
    segment: string,
    mtlNo: string,
    mtlName: string,
    mtlColor: string,
    mtlSpec: string,
    mtlUnit: string,
    size1: null,
    size2: null,
    vendor: string,
    usage: null,
    usageType: string,
    drawDept: string,
    sizeType: string,
    mtlProperty: string,
    noLotUsage: null,
    remark: null
}

export const TypeColorDataQuery = (parms:TypeColorDataQueryParms) => {
    return LoginWork.post<any,any>('/usage/getStyleToColorDetailsQuery',parms)
}

// 部位明细查询
export interface PositionDetailQueryPamrs{
    engPartName:string,
    pageNum:number,
    pageSize:number,
    partName:string,
    seqNo:string
}

export const PositionDetailQuery = (parms:PositionDetailQueryPamrs) => {
    return LoginWork.post<any,any>(`/date/getPartList`,parms)
}

// 贴合子材料明细查询
export interface LaminatedSubmaterialInterface{
    id: null,
    mtlNo: string,
    mtlColor: null,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    percent: 1,
    purFlag: string,
    mtlSeq: 2,
    prdType: null,
    vendor: null,
    colorCode: null
}

export const LaminatedSubmaterial = (parms:any) => {
    return service.post<any,LaminatedSubmaterialInterface[]>('/usage/getDetailsOfAdhesiveSubMaterials',parms)
}

// 全码用量资料查询
export interface FullCodeUsageDataParms{
    partName:string,
    segment:number | string,
    styleColor:string,
    styleNo:string
}

export const FullCodeUsageData = (parms:FullCodeUsageDataParms) => {
    return LoginWork.post<any,any>(`/usage/getFullCodeDetailList`,parms)
}

// 检核
export const FullCodeUsageCheck = (choose:number,parms:any) => {
    return SynchronizationLoginNork.post<any,any>(`/usage/getCheckOut/${choose}`,parms)
}

// 保存
export interface saveDateListParms{
    styleColor:string,
    styleColorMaterialRequests:any[],
    styleColorRemark:string,
    styleNo:string
}

export const saveDateList = (parms:saveDateListParms) => {
    return LoginWork.post<any,any>(`/usage/getStyleUsageDetailAdd`,parms)
}

// 用量明细查询
export interface UsageDetailQueryParms{
    styleNo:string,
    styleColor: string,
    typeName: string,
    seqNo: string,
    partName: string,
    segment: string,
    mtlNo: string,
    mtlName: string,
    mtlColor: string,
    mtlSpec: null,
    mtlUnit: string,
    size1: null,
    size2: null,
    vendor: null,
    usage:string,
    usageType: string,
    drawDept: string,
    sizeType: string,
    mtlProperty: string,
    noLotUsage: null,
    remark: null
}

export interface UsageDetailQueryParmsList{
    total?:number,
    list:UsageDetailQueryParms[]
}

export interface UsageDetailQueryPamrsList{
    mtlColor:string,
    mtlName:string,
    pageNum:number,
    pageSize:number,
    partName:string,
    styleColor:string,
    styleNo:string,
    typeName:string
}

export const UsageDetailQuery = (parms:UsageDetailQueryPamrsList) => {
    return LoginWork.post<any,UsageDetailQueryParmsList>(`/usage/getUsageDetailsQuery`,parms)
}

// 用量变更查询
export interface UsageChangeQueryparms{
    colorCode:string,
    pageNum:number,
    pageSize:number,
    styleColor:string,
    styleNo:string
}

export interface UsageChangeQueryInterface{
    total?:number
    list:UsageChangeQueryList[]
}

interface UsageChangeQueryList {
    partName: string,
    segment: number,
    changeType: string,
    remark:string,
    sysUser: string,
    sysDate: string
}

export const UsageChangeQuery = (parms:UsageChangeQueryparms) => {
    return Synchronization.post<any,UsageChangeQueryInterface>(`/usage/getUsageDetailsChangeQuery`,parms)
}

// 注意事项建档列表
export const PrecautionsFile = (parms:any) => {
    return Synchronization.post<any,any>(`/usage/getPrecautionsForFilingList`,parms)
}

// 注意事项建档
export const PrecautionsFileList = (parms:any) => {
    return Synchronization.post<any,any>(`/usage/getPrecautionsForFilingAdd`,parms)
}

// 复制资料
export interface CopyDataParms{
    colorCode:string,
    newColorCode:string,
    newStyleColor:string,
    newStyleNo:string,
    styleColor:string,
    styleNo:string,
    wantColor:string
}

export const CopyData = (parms:CopyDataParms) => {
    return SynchronizationLoginNork.post<any,any>(`/usage/getCopyingMaterials`,parms)
}

// 删除打勾记录型体
export interface DeleteTheCheckmarkedRecordTypePamrs{
    seqNoList:[],
    styleColor:string,
    styleNo:string
}

export const DeleteTheCheckmarkedRecordType = (parms:DeleteTheCheckmarkedRecordTypePamrs) => {
    return SynchronizationLoginNork.post<any,any>('/usage/getDeleteTickRecords',parms)
}

// 更新全码用量
export interface UpdateFullCodeUsagePamrs{
    list:any[],
    styleColor:string,
    styleNo:string
}

export const UpdateFullCodeUsage = (parms:UpdateFullCodeUsagePamrs) => {
    return SynchronizationLoginNork.post<any,any>(`/usage/getFullCodeDetailRenew`,parms)
}

// 选择材料当前行正式材料插入
export interface SelectTheCurrentRowToInsertParms{
    colorCode:string,
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    partName:string,
    segment:null | string,
    seqNo:string,
    styleColor:string,
    styleNo:string,
    vendor:string
}

export const SelectTheCurrentRowToInsert = (parms:SelectTheCurrentRowToInsertParms) => {
    return SynchronizationLoginNork.post<any,any>(`/date/getChooseCurrentMaterials`,parms)
}

// 生产正式材料并选择到用量表
export interface ProductionOfOfficialMaterialsParms{
    colorCode:string,
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    partName:string,
    segment:number | null,
    seqNo:string,
    styleColor:string,
    styleNo:string,
    vendor:string
}

export const ProductionOfOfficialMaterials = (parms:ProductionOfOfficialMaterialsParms) => {
    return SynchronizationLoginNork.post<any,any>(`/date/getChooseCompositeMaterials`,parms)
}

// 贴合材料处理->插入
export interface InsertTheBondingMaterialParms{
    colorCode:string,
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    partName:string,
    segment:number,
    seqNo:string,
    styleColor:string,
    styleNo:string,
    vendor:string
}

export const InsertTheBondingMaterial = (parms:InsertTheBondingMaterialParms) => {
    return SynchronizationLoginNork.post<any,any>(`/date/getInsertMaterial`,parms)
}

// 型体配色
export const styleColorQuery = (parms:any) =>{
    return service.post<any,any>(`/common/getStylePhotoList`,parms)
}

// 贴合材料处理-还原
export const BondingMaterialTreatment = (parm:any) => {
    return Synchronization.post<any,any>(`/date/restoration`,parm)
}

// 选择材料
export const selectMtlName = (parms:any) => {
    return Synchronization.post<any,any>(`/date/getMtlNameByMaterial`,parms)
}

// 复制材料
export const copyData = (parms:any) => {
    return SynchronizationLoginNork.post<any,any>(`/date/getMtlNoByMaterial`,parms)
}

// 部位查询
export const partNameQuery = (partName:string) => {
    const encodedPartName = encodeURIComponent(partName);  
    return LoginWork.get<any,any>(`/date/getPartName?partName=${encodedPartName}`)
}

// 删除正式材料
export const deleteCofficial = (partName:string) => {
    return SynchronizationLoginNork.post<any,any>(`/date/delMtlNoByMaterial?mtlNo=${partName}`)
}

// 保存基本号码
export const BasicNumber = (parms:any) =>{
    return SynchronizationLoginNork.post<any,any>(`/usage/updateBaseSize`,parms)
}